package com.test.client.customTimeLine;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;

public class EventSource extends JavaScriptObject {
	protected EventSource() {
		super();
	}

	public static EventSource create() {
		return EventSourceImpl.createEventSourceObject();
	}

	/**
	 * Load data stream into timeline event source
	 * 
	 * @param dataUrl
	 */
	public final void loadXML(String dataUrl) {
		EventSourceImpl.loadXML(dataUrl, this);
	}

	/**
	 * Load xml string directly into source
	 */
	public final void loadXMLText(String xmlText) {
		EventSourceImpl.loadXMLText(xmlText, GWT.getModuleBaseURL(), this);
	}

	/**
	 * Load json string directly into source
	 * 
	 * @param json
	 */
	public final void loadJSON(String json) {
		EventSourceImpl.loadJSON(json, GWT.getModuleBaseURL(), this);
	}

	/**
	 * Load data stream into timeline event source
	 */
	public final void load(JavaScriptObject xml, String url) {
		EventSourceImpl.loadXML(xml, url, this);
	}

	public final void clear() {
		EventSourceImpl.clear(this);
	}

}
